#
# patches to site helper for SimpleLog
# by S. Brent Faulkner (brentf@unwwwired.net) - Sep 7, 2007
#

#
# OMG... what a headache... there HAS to be an easier way to replace a method in a rails application's helper class
#
class Site

  def self.singleton_method_added(id)

    # prevent recursion
    return if @ignore_singleton_method
    
    begin
      @ignore_singleton_method = true

      case id
      when :default_meta_tags
        class_eval do
          class << self
            # default chunk of meta tags for author, description, title
            def default_meta_tags(content_type = 'text/html')
              block  = %Q(<meta http-equiv="content-type" content="#{content_type}; charset=#{Preference.get_setting('encoding')}"/>) + "\n\t"
              block += simple_meta_tag('author', Preference.get_setting('site_primary_author')) + "\n\t"
          		block += simple_meta_tag('description', Comment.kill_tags(Preference.get_setting('site_description'))) + "\n\t"
          		block += simple_meta_tag('dc.title', Preference.get_setting('site_name')) + "\n\t"
          		block += '<link rel="start" href="' + self.full_url + '" title="' + Preference.get_setting('site_name') + '"/>'
          		return block
            end # def default_meta_tags
          end # class << self
        end # class_eval
      end # case id

    ensure
      @ignore_singleton_method = false

    end # begin/ensure

  end # singleton_method_added

end # class Site